#include <iostream>
#include "mtfW.h"
#include "Alfabeto.h"

using namespace std;

int mtf_algoritmoW(unsigned char * L,unsigned char * R,unsigned int N,Alfabeto& alf){
    
    unsigned char ch;
    int i = 0;
    
    //cout << "mtfW - entra R: " << R << endl;
    
    for (i=0;i<N;i++){
        if( alf.obtener_char(R[i],&ch) ) return -1;
        L[i] = ch;
        alf.mover_al_frente(R[i]);
        
    }
    
    //cout << "mtfW - sale L: " << L << endl;
    return 0;
}
